package niuke;

/**
 * Created by linshuo on 2018/3/1.
 *
 * 变态跳台阶
 */
public class JumpFloorAbnormal {
    public int jumpRecur(int n) {
        if (n == 0)
            return 0;
        if (n == 1)
            return 1;
        return 2 * jumpRecur(n - 1);
    }

    public int jumpIteration(int n) {
        if (n == 0)
            return 0;
        if (n == 1)
            return 1;
        int temp = 1;
        for (int i = 1; i < n; i++) {
            temp *= 2;
        }
        return temp;
    }

    public static void main(String[] args) {
        JumpFloorAbnormal jump = new JumpFloorAbnormal();
        System.out.println(jump.jumpRecur(4));
        System.out.println(jump.jumpIteration(4));
    }
}
